                Picomite - The story so far - Very Provisional Docs

* Use
* OPTION RESET
* FLASH ERASE ALL
* VAR CLEAR
* to clean up before and after loading the alpha


FLASH ERASE n ' erases a flash program slot n=1 to 10
FLASH ERASE ALL ' erases all flash program slots
FLASH LIST 'Display list of flash area 1-10 contents
FLASH SAVE n ' Saves the current program to the flash slot specified
FLASH LOAD n ' Loads a program from the specified flash spot
FLASH RUN n ' Runs a program from the specified flash spot, clears all variables
FLASH CHAIN n ' Runs a program from the specified flash spot, leaves all variables

OPTION AUTORUN OFF|ON|n where n is the flash program slot to be loaded and run

------------------------
a3
LIST COMMANDS
LIST OPTIONS
settick & watchdog working

------------------------
a4
PIN() can use either Picomite pin numbers or GPn references

------------------------
a10
PIN(41) or PIN(GP25) can be put under user control instead of 'heartbeat' flasher
SETPIN 41, DOUT|HEARTBEAT
SETPIN GP25, DOUT|HEARTBEAT

------------------------
a12
PRINT PIN(TEMP) to read the temperature of the chip
Analogue input available on GP26, GP27 & GP28

------------------------
a13
HUMID pin, temp!, humid!, type
type=1 for DHT11 or omitted for DHT22
PORT()

------------------------
a14
OPTION POWER PFM|PWM
defaults to PFM mode
UPDATE FIRMWARE

------------------------
a15
SD card no longer fonfigured by default.
OPTION SDCARD  SD_CLKpin, Option.SD_MOSIpin, SD_MISOpin, SD_CSpin
for original connections use OPTION SDCARD 4,5,6,7
Available RAM reduced from 96k to 80k. 
About 50% increase in speed.

------------------------
a17
OPTION CPUSPEED cpuspeedinkhz
Defaults to 125000 with options cleared. 48000-250000 can be selected.

------------------------
a19
Up to 8 PWM channels (0-7) can be used. Each of these can have it's own
frequency.Each channel can have up to two outputs (A & B), which can have the
same or different duty cycle (0-100%). This gives a total of 16 PWM outputs.
The duty cycle can be a float value.

SETPIN pin, PWMnx.
PWM channel, frequency, [dutyA] [,dutyB]
PWM channel, OFF

e.g.

SETPIN 1,PWM0A    'Provisionally allocate pin 1 (GP0) to PWM0A
SETPIN 2,PWM0B    'Provisionally allocate pin 2 (GP1) tp PWM0B
PWM 0,1000,33,67  'Frequency is 1kHz for PWM0x, PWM0A is 33%, PWM0B is 67%
                  'The pins are now locked to PWM usage until PWM 0,OFF
PWM 0,OFF         'PWM0A and PWM0B are both off and the pins are released

The setpin can be changed until the PWM command is issued. At that point the
pin becomes locked to PWM until PWM n,OFF is issued
There are 8 separate PWM frequencies available (0 - 7) and up to 16 outputs
with individually controlled duty cycle. You can output on either PWMnA or
PWMnB or both for each channel - no restriction
Minimum frequency is given by the equation
65535 < (OPTION CPUSPEED * 1000)/256
This gives a minimum frequuency of 7.5Hz with a clock speed of 125MHz
Maximum speed is OPTION CPUSPEED/4
Of course at very fast speeds the duty cycles will be increasingly limited

Valid channels for PWM and other special functions are given in the attached
table and the codes for SETPIN are as in the table.
Pin Ref   Possible modes
1   GP0   DIGITAL_IN | DIGITAL_OUT | UART0TX | SPI0RX | I2C0SDA | PWM0A
2   GP1   DIGITAL_IN | DIGITAL_OUT | UART0RX | I2C0SCL | PWM0B
3   GND                                                        
4   GP2   DIGITAL_IN | DIGITAL_OUT | SPI0SCK | I2C1SDA | PWM1A
5   GP3   DIGITAL_IN | DIGITAL_OUT | SPI0TX | I2C1SCL | PWM1B
6   GP4   DIGITAL_IN | DIGITAL_OUT | UART1TX | SPI0RX | I2C0SDA | PWM2A
7   GP5   DIGITAL_IN | DIGITAL_OUT | UART1RX | I2C0SCL | PWM2B
8   GND
9   GP6   DIGITAL_IN | DIGITAL_OUT | SPI0SCK | I2C1SDA | PWM3A
10  GP7   DIGITAL_IN | DIGITAL_OUT | SPI0TX | I2C1SCL | EXT_PWM3B
11  GP8   DIGITAL_IN | DIGITAL_OUT | UART1TX | SPI1RX | I2C0SDA | PWM4A
12  GP9   DIGITAL_IN | DIGITAL_OUT | UART1RX | I2C0SCL | PWM4B
13        GND 
14  GP10  DIGITAL_IN | DIGITAL_OUT | SPI1SCK | I2C1SDA | PWM5A
15  GP11  DIGITAL_IN | DIGITAL_OUT | SPI1TX | I2C1SCL | PWM5B
16  GP12  DIGITAL_IN | DIGITAL_OUT | UART0TX | SPI1RX | I2C0SDA | PWM6A
17  GP13  DIGITAL_IN | DIGITAL_OUT | UART0RX | I2C0SCL | PWM6B
18        GND 
19  GP14  DIGITAL_IN | DIGITAL_OUT | SPI1SCK | I2C1SDA | PWM7A
20  GP15  DIGITAL_IN | DIGITAL_OUT | SPI1TX | I2C1SCL | PWM7B


21  GP16  DIGITAL_IN | DIGITAL_OUT | UART0TX | SPI0RX | I2C0SDA | PWM0A
22  GP17  DIGITAL_IN | DIGITAL_OUT | UART0RX | I2C0SCL | PWM0B
23        GND 
24  GP18  DIGITAL_IN | DIGITAL_OUT | SPI0SCK | I2C1SDA | PWM1A
25  GP19  DIGITAL_IN | DIGITAL_OUT | SPI0TX | I2C1SCL | PWM1B
26  GP20  DIGITAL_IN | DIGITAL_OUT | I2C0SDA | PWM2A
27  GP21  DIGITAL_IN | DIGITAL_OUT | I2C0SCL | PWM2B
28        GND  
29  GP22  DIGITAL_IN | DIGITAL_OUT | PWM3A
30        RUN   
31  GP26  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN | I2C1SDA | PWM5AI2C
33        AGND 
34  GP28  DIGITAL_IN | DIGITAL_OUT | ANALOG_IN | PWM6A
35        VREF
36        3V3 OUT
37        3V3 ENABLE
38        GND
39        VSYS
40        VBUS

41  GP25  DIGITAL_OUT | PWM4B    Onboard LED so not wired out to a pin

------------------------
a20
I2C (channel 0) and I2C1 (channel 1) added.

SETPIN pin, I2C0SDA
SETPIN pin, I2C0SCL
I2C OPEN speed,timeout
I2C WRITE addr, option, sendlen, senddata [,senddata ...]
I2C READ addr, option, rcvlen, revbuf
I2C CLOSE

SETPIN pin, I2C1SDA
SETPIN pin, I2C1SCL
I2C1 OPEN speed,timeout
I2C1 WRITE addr, option, sendlen, senddata [,senddata ...]
I2C1 READ addr, option, rcvlen, revbuf
I2C1 CLOSE

------------------------


